package com.kinyx.framework.constraints;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import com.kinyx.framework.constraints.UsingStatus.Validator;
import com.kinyx.framework.utils.KEnumUtils;

/**
 * 在用状态验证注解
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = Validator.class)
public @interface UsingStatus {

	public static final String REGEX = KEnumUtils.getRegex(com.kinyx.framework.enums.impl.UsingStatus.class);

	String message() default "";

	Class<?>[] groups() default {};

	Class<? extends Payload>[] payload() default {};

	class Validator extends RegexMatchValidator<UsingStatus> {

		@Override
		protected String getRegex() { return REGEX; }

	}

}
